Repository navigation
Conversation
iO7i
marked this pull request as ready for review
September 8, 2026 15:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Addresses the outbound-network SSRF finding in #66 (not the other findings).
curl_urlcurrently checks the hostname string, while curl resolves the actual destination later. A public-looking name can therefore pass validation and resolve to an internal address. The tool also accepts non-HTTP URL schemes despite its HTTP contract.The invariant here is: the destination used by execution must be the destination that passed validation.
What changed
curl_urlto HTTP(S). Execute the canonical parsed URL and pin hostname requests with--resolve, retaining the hostname for HTTP and TLS. Literal IP URLs are validated and already numeric.check_portprobe the validated numeric address with netcat's numeric-only mode. The explicit/defaultlocalhostdiagnostic remains permitted and uses127.0.0.1without DNS; other loopback/private targets are rejected.npm testusing Node's built-in runner, with injected DNS and command execution. No new package dependency.The address policy is deliberately conservative: IPv4 special-use ranges are denied, and IPv6 is restricted to ordinary global unicast excluding special-purpose/tunneling ranges. This also rejects documentation ranges and IPv4-mapped IPv6, even when the embedded IPv4 address is public. Pinning chooses one validated address and does not introduce connection fallback. These tools now require direct outbound access rather than an environment proxy.
Scope is limited to these outbound tools; no changes to trust levels, tool assignment, nginx reload behavior, or proxy policy elsewhere. This is not a sandbox for other tools or a replacement for deployment-level egress controls.
Behavioral verification
48 deterministic tests pass on Node 22.12.0. Coverage includes private/special IPv4 and IPv6 literals, alternate numeric URL spellings, non-HTTP schemes, private and mixed DNS answers in both orders, DNS failure/timeout, and the explicit localhost exception.
Handler-level tests verify that a resolver which would return loopback on a second call is called only once, the resulting command pins the first validated address, custom ports/IPv6 pins are formatted correctly, the original HTTP(S) hostname is retained, and blocked requests never reach command execution. The tests also check curlrc/proxy/globbing safeguards and absence of redirect/TLS-bypass flags.
DNS and command execution are mocked throughout; no live network, curl/netcat process, or end-to-end application run is claimed. The existing frozen pnpm install fails because the lockfile still lists
better-sqlite3, which is absent frompackage.json; the lockfile is unchanged here.